## 添加选项配置
#include(${CMAKE_SOURCE_DIR}/cmake/gcc-arm-none-eabi.cmake)
#include(${CMAKE_SOURCE_DIR}/cmake/common.cmake)
#include(${CMAKE_SOURCE_DIR}/cmake/options/options_system.cmake)
## 添加生成配置文件
#include(${CMAKE_SOURCE_DIR}/cmake/options/generate_config.cmake)
## 公共包含目录
#include_directories(
#        ${CMAKE_SOURCE_DIR}/Projects/shared
#)
#
## 下面的函数不具备通用性，专门用于本工程的简化
#
## =================================================================
## 添加STM32项目，必须放在子项目CMakeLists中的末尾
#function(add_stm32_project PROJECT_NAME)
#    message(STATUS "[Project] Adding ${PROJECT_NAME} ...")
#
#    # ---------- 检测是否有额外参数 ----------
#    message(STATUS "    start receive other sources...")
#    set(SOURCES "")
#    # 获取所有额外参数作为源文件
#    if (${ARGC} GREATER 1)
#        set(SOURCES ${ARGN})
#    endif ()
#
#    # 项目默认源文件
#    if (ENABLE_GUI)
#        file(GLOB_RECURSE BASE_SOURCES "${CMAKE_SOURCE_DIR}/Projects/shared/*.cpp" "core/*.cpp" "ui/*.c")
#    else ()
#        file(GLOB_RECURSE BASE_SOURCES "${CMAKE_SOURCE_DIR}/Projects/shared/*.cpp" "core/*.cpp")
#    endif ()
#
#
#    # ---------- 创建可执行目标 ----------
#    add_executable(${PROJECT_NAME} ${SOURCES} ${BASE_SOURCES})
#
#    target_include_directories(${PROJECT_NAME} PRIVATE
#            ${CMAKE_CURRENT_SOURCE_DIR}# 项目私有目录
#    )
#
#    # -------------------- 添加模块 --------------------
#    if (ENABLE_GUI)
#        file(GLOB_RECURSE project_modules "${CMAKE_CURRENT_SOURCE_DIR}/core/*.ixx" "${CMAKE_CURRENT_SOURCE_DIR}/ui/*.ixx")
#
#    else ()
#        file(GLOB_RECURSE project_modules "${CMAKE_CURRENT_SOURCE_DIR}/core/*.ixx")
#    endif ()
#
#    # 添加模块
#    set(PROJECT_MODULE project_${PROJECT_NAME})
#    register_global_module(NAME ${PROJECT_MODULE} FILES ${project_modules} DEPENDS BSP_MODULE_OBJECT HAL_MODULE_OBJECT)
#
#
#
#    # 添加到可执行文件
#    target_sources(${PROJECT_NAME} PUBLIC
#            $<TARGET_OBJECTS:STM32_DRIVERS_OBJECT>
#            $<TARGET_OBJECTS:HAL_MODULE_OBJECT>
#            $<TARGET_OBJECTS:BSP_MODULE_OBJECT>
#            $<TARGET_OBJECTS:${PROJECT_MODULE}_MODULE_OBJECT>
#            # ！！需要手动添加对象库的地方，这些对象库都是根目录的模块
#    )
#
#    # 把Adapter、BSP开放给Project里的源文件
#    target_link_libraries(${PROJECT_NAME}
#            PUBLIC ${PROJECT_MODULE}_MODULE_INTERFACE
#            PUBLIC HAL_MODULE_INTERFACE
#            PUBLIC BSP_MODULE_INTERFACE
#            PUBLIC STM32_DRIVERS_INTERFACE
#    )
#
#    # 预编译系统头文件避免冲突
#    target_precompile_headers(${PROJECT_NAME} PRIVATE
#            <sys/lock.h>
#            <sys/reent.h>
#    )
#
#    # ------------ 相关编译逻辑 ------------
#
#    if(ENABLE_GUI)
#        # 对子项目模块添加GUI模块
#        target_sources(${PROJECT_MODULE}_MODULE_OBJECT PUBLIC $<TARGET_OBJECTS:ADAPTER_GUI_MODULE_OBJECT>)
#        target_link_libraries(${PROJECT_MODULE}_MODULE_OBJECT PUBLIC ADAPTER_GUI_MODULE_INTERFACE)
#
#        #    target_sources(${PROJECT_NAME} PUBLIC $<TARGET_OBJECTS:ADAPTER_GUI_MODULE_OBJECT>)
#        target_link_libraries(${PROJECT_NAME} PUBLIC MIDDLEWARE_LVGL_INTERFACE ADAPTER_GUI_MODULE_INTERFACE)
#    endif ()
#
#
#
#    # -------------------------------- 链接静态库 --------------------------------
#    # ETL可以实现状态机、简单任务调度、循环缓冲区等
#    if(ENABLE_ETL)
#        add_subdirectory(${CMAKE_SOURCE_DIR}/Middleware/Third_Party/etl
#                ${CMAKE_BINARY_DIR}/Middleware/Third_Party/etl_build)
#        target_link_libraries(${PROJECT_NAME} PUBLIC etl::etl)
#    endif ()
#
#    # 导入Rust
#    if (ENABLE_RUST)
#        add_dependencies(${PROJECT_NAME} rust_lib)
#        target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/Rust/include")
#        target_link_libraries(${PROJECT_NAME} PRIVATE
#                "${CMAKE_SOURCE_DIR}/Rust/target/thumbv7em-none-eabihf/release/libembedded_rust.a"
#        )
#    endif ()
#
#
#    if (ENABLE_AI)
#        message(STATUS "[AI]:ON")
#        target_link_directories(${PROJECT_NAME} PRIVATE Middleware/ST/AI/Lib)
#        target_include_directories(${PROJECT_NAME} PUBLIC Middleware/ST/AI/Inc)
#        target_link_libraries(${PROJECT_NAME} PRIVATE :NetworkRuntime1000_CM4_GCC.a)
#    endif ()
#
#    # -------------------------------- 自定义命令 --------------------------------
#    # 添加自定义命令：=生成十六进制和二进制文件
#    add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
#            COMMAND ${CMAKE_OBJCOPY} -Oihex $<TARGET_FILE:${PROJECT_NAME}> ${CMAKE_PROJECT_NAME}.hex
#            COMMAND ${CMAKE_OBJCOPY} -Obinary $<TARGET_FILE:${PROJECT_NAME}> ${CMAKE_PROJECT_NAME}.bin
#            COMMAND ${CMAKE_NM} -n $<TARGET_FILE:${PROJECT_NAME}> > ${CMAKE_PROJECT_NAME}.sym
#            COMMENT "Building hex & bin files")
#endfunction()
#
#
#
